package hx.entity; /***********************************************************************
 * Module:  Talkpackage.java
 * Author:  Administrator
 * Purpose: Defines the Class Talkpackage
 ***********************************************************************/

import hx.entity.MobileCard;
import hx.entity.ServicePackage;
import hx.service.CallService;
import hx.service.SendService;

import java.io.Serializable;

/** @pdOid 9607aad1-f2a9-49b6-9b1a-def56d3cbf4d */
public class Talkpackage extends ServicePackage implements Serializable, CallService, SendService {
   /** @pdOid 4b12816e-1d7f-46a0-9a83-c016c3cd21c4 */
   private int talkTime;
   /** @pdOid e45308ef-0b47-49b6-b573-5a1e4bad6258 */
   private int smsCount;

   public Talkpackage() {
      super(58);
      this.talkTime = 500;
      this.smsCount = 30;
   }

   public int getTalkTime() {
      return talkTime;
   }

   public void setTalkTime(int talkTime) {
      this.talkTime = talkTime;
   }

   public int getSmsCount() {
      return smsCount;
   }

   public void setSmsCount(int smsCount) {
      this.smsCount = smsCount;
   }

   @Override
   public void show() {
      System.out.println("套餐名字："+"\t"+"话痨套餐");
      System.out.println("通话时长(分钟)："+"\t"+this.getTalkTime());
      System.out.println("上网流量(GB)："+"\t"+"无");
      System.out.println("短信条数(条)："+"\t"+this.getSmsCount());
      System.out.println("资费(元/月)："+"\t"+super.getPrice());

   }
   @Override
   public void shouwInfo() {
      System.out.println("通话时长："+getTalkTime()+"分钟");
      System.out.println("短信条数："+getSmsCount()+"条");
      System.out.println("上网流量："+0+"GB");
   }


   /** @pdOid 43a40fd5-5c29-45de-993c-becabe688bd4 */
   public void showInfo() {

   }
   
   /** @param minCount 
    * @param card
    * @pdOid 39711d76-2511-4e3a-b1de-df8fa98e1e01 */
   public int call(int minCount, MobileCard card) {

      double monet=card.getMoney();
      setTalkTime(talkTime-minCount);
      if (getTalkTime()<0){
         card.setMoney(monet-getTalkTime()*(-0.2));
         setTalkTime(0);

      }
      return minCount ;
   }
   
   /** @param count 
    * @param card
    * @pdOid 84c6c317-aeb0-48b8-b530-4b447e52c5ba */
   public int send(int count, MobileCard card) {
      double monet=card.getMoney();
      setSmsCount(smsCount-count);
      if (getSmsCount()<0){
         card.setMoney(monet-getSmsCount()*(-0.1));
         setSmsCount(0);

      }
      return count;
   }

}